package com.yhp.web.filter;

import java.io.IOException;
import javax.servlet.*;

/**
 * 中文编码过滤器
 *
 * @author bing.zhang06@hand-china.com 2021/7/31 14:19
 **/
public class EncodeFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setCharacterEncoding("UTF-8");
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {

    }
}
